#include <numeric>
#include <algorithm>
#include <stdio.h>
#include <sys/time.h>
#include <stdlib.h>
#include <vector>
#include <string.h>

#include "stdint.h"

using namespace std;

#include <x264.h>

#include "base_encoder.h"
#include "../common.h"

using namespace std;

class X264Encoder : public BaseEncoder {

public:
	X264Encoder(int p_width, int p_height);
	virtual ~X264Encoder();

	virtual int init();
	virtual int encodeFrame(unsigned char* yuv_data, unsigned char* encode_buffer, int& length);
	virtual void close();

private:
	int width;
	int height;
	int csp;
	int y_size;
	int frame_idx;
	int iNal;
	x264_param_t* pParam;
	x264_picture_t* pPic_out;
	x264_picture_t* pPic_in;
	x264_t* pHandle;
	x264_nal_t* pNals;
};
